home *** CD-ROM | disk | FTP | other *** search
/ Shocking The Web CD-ROM / SHOCK_CD.ISO / pc / tutorial / devglry / zoetek / source / shckclck.dir / 00095_Timer Routines.ls < prev    next >
Encoding:
Text File  |  1996-04-11  |  969 b   |  48 lines

  1. global tick, timerval, timeron, smallnil, bignil, mouseVal, beeps
  2.  
  3. on timerInit
  4.   set timeron to 0
  5.   set timerval to [#hour: 0, #minute: 0, #second: 0]
  6.   startTimer()
  7. end
  8.  
  9. on timer
  10.   if tick then
  11.     donum(1, bignil, 1, the hour of timerval)
  12.     donum(4, bignil, 1, the minute of timerval)
  13.     donum(7, bignil, 1, the second of timerval)
  14.   end if
  15. end
  16.  
  17. on timerdone
  18.   return not (the hour of timerval or the minute of timerval or the second of timerval)
  19. end
  20.  
  21. on timerInc
  22.   inc(timerval, 100, 0)
  23.   set timerval to the result
  24.   timer()
  25. end
  26.  
  27. on checkTimer
  28.   if timeron then
  29.     timerdone()
  30.     if not (the result) then
  31.       checkMouse()
  32.       if not (the result) then
  33.         set mouseVal to [#hour: 0, #minute: 0, #second: -1]
  34.         inc(timerval, 100, 1)
  35.         set timerval to the result
  36.       end if
  37.     else
  38.       set timeron to 0
  39.       return 0
  40.     end if
  41.     timerdone()
  42.     if the result then
  43.       set beeps to 15
  44.       set timeron to 0
  45.     end if
  46.   end if
  47. end
  48.